import { createPage, PAGE_ROOT_SYMBOL } from '../../common/weapp-page'
import { concatClassList, px2rpx } from '@cloudbase/weda-client'
import { app, $app } from '../../app/weapps-api'
import { $0 as handlers } from '../../app/handlers'
const lifecycle = {}
const state = {}
const computed = {}
import { $page, $w } from './api'
import { widgetProps } from './data'





/** widget event listeners **/
const evtListeners = {"onid17$onDataChange": [
      {
          key: '',
          sourceKey: ':',
          handler: ({event})=>{
      if(event.currentTarget) {
        $app.utils.set(event.currentTarget._scope, 'dataContext.data', event?.detail?.data);
        $app.utils.set(event.currentTarget._scope, 'dataContext.state', event?.detail?.state);
      }
    },
          args: {
  "params": [
    {}
  ]
},
          argsBinds: {}
        }
    ],"onid61$tap": [
      {
          key: 'w1mdsbtff78',
          sourceKey: 'platform:cloud.callDataSource',
          handler: function({args}){ return $app.cloud.callDataSource(...args)},
          args: {
  "params": [
    {
      "params": {
        "ddh": ""
      },
      "options": {
        "showToast": false,
        "showLoading": true
      },
      "outputs": {},
      "methodName": "wedaCreate",
      "dataSourceName": "wxzfmbddsj_CvVA"
    }
  ]
},
          argsBinds: {'params.0.params.spjg': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      $w.item_33tc.spjg
    )},'params.0.params.spmc': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      $w.item_33tc.spmc
    )}}
        }
    ],"onid61$w1mdsbtff78_success": [
      {
          key: 'w2e7lhlm30g',
          sourceKey: 'platform:cloud.callDataSource',
          handler: function({args}){ return $app.cloud.callDataSource(...args)},
          args: {
  "params": [
    {
      "params": {},
      "options": {
        "showToast": false,
        "showLoading": false
      },
      "outputs": "",
      "methodName": "wedaGetItem",
      "dataSourceName": "wxzfmbddsj_CvVA"
    }
  ]
},
          argsBinds: {'params.0.params._id': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      event.detail._id
    )}}
        }
    ],"onid61$w2e7lhlm30g_success": [
      {
          key: 'wb5nis8fxms',
          sourceKey: 'index:pay',
          handler: handlers.pay,
          args: {
  "params": [
    {
      "target": ""
    }
  ]
},
          argsBinds: {}
        }
    ],"onid61$wb5nis8fxms_success": [
      {
          key: 'wg13twtq6gb',
          sourceKey: 'platform:showToast',
          handler: function({args}){ return $app.showToast(...args)},
          args: {
  "params": [
    {
      "icon": "success",
      "title": "支付成功",
      "duration": 1500
    }
  ]
},
          argsBinds: {}
        },{
          key: 'wju50rkfwzy',
          sourceKey: 'platform:cloud.callDataSource',
          handler: function({args}){ return $app.cloud.callDataSource(...args)},
          args: {
  "params": [
    {
      "params": {
        "data": {
          "zfzt": 2
        },
        "select": {
          "$master": true
        }
      },
      "options": {
        "showToast": false,
        "showLoading": false
      },
      "outputs": {},
      "methodName": "wedaUpdateV2",
      "dataSourceName": "wxzfmbddsj_CvVA"
    }
  ]
},
          argsBinds: {'params.0.params.filter': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      {
 "where": {
  "$and": [
   {
    "$and": [
     {
      "_id": {
       "$eq": event.detail
      }
     }
    ]
   }
  ]
 },
 "relateWhere": {}
}
    )}}
        }
    ],"onid61$wb5nis8fxms_fail": [
      {
          key: 'wqz4nkaqixu',
          sourceKey: 'platform:showToast',
          handler: function({args}){ return $app.showToast(...args)},
          args: {
  "params": [
    {
      "icon": "error",
      "title": "支付失败",
      "duration": 1500
    }
  ]
},
          argsBinds: {}
        }
    ],"onid61$w2e7lhlm30g_fail": [
      {
          key: 'wq5cl620f68',
          sourceKey: 'platform:showToast',
          handler: function({args}){ return $app.showToast(...args)},
          args: {
  "params": [
    {
      "icon": "error",
      "title": "发起支付失败"
    }
  ]
},
          argsBinds: {}
        }
    ],"onid61$w1mdsbtff78_fail": [
      {
          key: 'wktkaq3fk8',
          sourceKey: 'platform:showToast',
          handler: function({args}){ return $app.showToast(...args)},
          args: {
  "params": [
    {
      "icon": "error",
      "title": "创建订单失败"
    }
  ]
},
          argsBinds: {}
        }
    ],}

const dataBinds = {
  [PAGE_ROOT_SYMBOL]: {
    
  },
  id49: { 'data': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      $context.id17.data
    )}
  },
  id49_item: { '_waFor': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      $context.id17.data
    )}
  },
  id53: { 'src': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      $w.item_33tc.sptp
    )}
  },
  id58: { 'text': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      $w.item_33tc.spmc
    )}
  },
  id57: { 'text': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      $w.item_33tc.spms
    )}
  },
  id59: { 'text': ($page, lists, forItems, event, $context, $w, params) => {const $for = forItems; const $index=lists?.[0]?.currentIndex; return(
      '￥ ' + $w.item_33tc.spjg / 100
    )}
  },
}

const query = {
}

const eventFlows = [
]

const datasetProfile = {
  "state": {},
  "params": {}
}

createPage({
  app,
  pageContext: $page,
  id: 'index',
  widgetProps,
  lifecycle,
  state,
  computed,
  evtListeners,
  dataBinds,
  handlers,
  query,
  eventFlows,
  pageAttributes: {},
  resetShare: false,
  datasetProfile
})
